<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <LINK rel="Bookmark" href="/favicon.ico">
    <LINK rel="Shortcut Icon" href="/favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/Public/static/html5.js"></script>
    <script type="text/javascript" src="/Public/static/respond.min.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/PIE_IE678.js"></script>
    <![endif]-->
    <link href="/Public/Admin/css/manager/H-ui.min.css" rel="stylesheet" type="text/css"/>
    <link href="/Public/Admin/css/manager/H-ui.admin.css" rel="stylesheet" type="text/css"/>
    <link href="/Public/Admin/css/skin/default/skin.css" rel="stylesheet" type="text/css"/>
    <link href="/Public/Admin/css/manager/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css"/>
    <link href="/Public/Admin/css/common.css" rel="stylesheet" type="text/css"/>
    <link href="/Public/Admin/css/application.css" rel="stylesheet" type="text/css"/>
    <title>后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <script type="text/javascript" src="/Public/static/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="/Public/static/layer/layer.js"></script>
    <script type="application/javascript" src="/Public/static/form/jquery.validate.min.js"></script>
    <script type="application/javascript" src="/Public/static/form/localization/messages_zh.min.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/H-ui.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/H-ui.admin.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/common.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/jquery.raty.min.js"></script>
    <script type="text/javascript" src="/Public/Admin/js/timer.js"></script>
    <script type="text/javascript">
        $(function () {
            //搜索功能
            $("#search_layer").click(function () {
                layer.closeAll();
                layer.open({
                    type: 2,
                    title: 'id搜索工具',
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['650px', '550px'],
                    content: '<?php echo U("/Admin/Doctor/NRDoctor/search");?>'
                });
            });
        })
    </script>
</head>
<div class="pd-20">
    <!--头部按钮-->
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <?php if(!empty($actions)): ?><!--批量删除-->
            <?php if(isset($actions['PATIENTDELETE'])): ?><span class="l mr-10">
                    <a class="btn btn-primary radius" id="delete" href="javascript:;" _href="<?php $str = $Think.ADMIN_PATH_NAME.$actions['PATIENTDELETE']['url'];echo U($str,array('key'=>$actions['PATIENTDELETE']['key']))?>">删除</a>
                 </span><?php endif; ?>
            <?php if(isset($actions['PATIENTADD'])): ?><span class="l mr-10">
                    <a class="btn btn-primary radius" href="<?php $str = $Think.ADMIN_PATH_NAME.$actions['PATIENTADD']['url'];echo U($str,array('key'=>$actions['PATIENTADD']['key']))?>">新增</a>
                 </span><?php endif; ?>
            <!--excel导入-->
            <?php if(isset($actions['PATIENTADD'])): ?><span class="l mr-10">
                    <a class="btn btn-primary radius" href="/Uploads/Excel/patient.xlsx">excel模板下载</a>
                 </span>
                <span class="l mr-10">
                    <input type='file' id="excel_uploader" class="uploader"/>
                 </span><?php endif; endif; ?>
        <!-- 高级搜索 -->
        <div class="search-form fr cf" style="margin-left: 600px">
            <div class="sleft">
                <input type="text" name="name" id="name" value="<?php echo I('name');?>" class="search-input" placeholder="请输入患者名">&nbsp;
                <a class="sch-btn" href="javascript:;" id="search"><i class="Hui-iconfont btn-search">&#xe665;</i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->

    <div class="mt-20">
        <div class="data-table table-striped">
            <table class="table table-border table-bordered table-bg table-sort">
                <thead>
                <tr class="text-c">
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                    <th class="">ID</th>
                    <th class="">头像</th>
                    <th class="">姓名</th>
                    <th class="">身份证号</th>
                    <th class="">性别</th>
                    <th class="">年龄</th>
                    <th class="">地址</th>
                    <th class="">手机号码</th>
                    <th class="">婚育史</th>
                    <th class="">手术和外伤</th>
                    <th class="">家族病史</th>
                    <th class="">药物过敏</th>
                    <th class="">食物和接触物过敏</th>
                    <th class="">个人习惯</th>
                    <th class="">备注</th>
                    <th class="">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php if(!empty($_list)): if(is_array($_list)): $i = 0; $__LIST__ = $_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="text-c">
                            <td>
                                <input class="ids" type="checkbox" name="id" value="<?php echo ($vo["id"]); ?>" data-other="<?php echo ($vo["id"]); ?>" />
                                </td>
                            <td><?php echo ($vo["id"]); ?></td>
                            <td><img src="<?php echo ($vo["image"]); ?>" style="width: 60px" onerror="this.src='/Public/Admin/images/nopic.png'"></td>
                            <td><?php echo ($vo["name"]); ?></td>
                            <td><?php echo ($vo["idcard"]); ?></td>
                            <td><?php echo ($vo['sex']==0?'女':'男'); ?></td>
                            <td><?php echo ($vo["age"]); ?></td>
                            <td><?php echo ($vo["address"]); ?></td>
                            <td><?php echo ($vo["mobile"]); ?></td>
                            <td><?php echo ($vo["obsterical_history"]); ?></td>
                            <td><?php echo ($vo["operation_trauma"]); ?></td>
                            <td><?php echo ($vo["family_history"]); ?></td>
                            <td><?php echo ($vo["drug_allergy"]); ?></td>
                            <td><?php echo ($vo["contact_allergy"]); ?></td>
                            <td><?php echo ($vo["habit"]); ?></td>
                            <td><?php echo ($vo["remark"]); ?></td>
                           <td>
                               <?php if(isset($actions['PATIIENTFAMILY'])): ?><a title="家庭档案" href="javascript:;" onclick="admin_edit('家庭档案', '<?php $str = $Think.ADMIN_PATH_NAME.$actions['PATIIENTFAMILY']['url'];echo U($str,array('key'=>$actions['PATIIENTFAMILY']['key'],'family_id'=>$vo['family_id']))?>', '1', '800', '500')" class="ml-5" style="text-decoration:none">
                                       家庭档案
                                   </a><?php endif; ?>
                                   <?php if(isset($actions['PATIENTDIT'])): ?><a class="btn btn-link" href="<?php $str = $Think.ADMIN_PATH_NAME.$actions['PATIENTDIT']['url'];echo U($str,array('key'=>$actions['PATIENTDIT']['key'],'id'=>$vo['id']))?>">编辑</a><?php endif; ?>
                               <?php if(isset($actions['PATIENTDELETE'])): ?><a class="btn btn-link delete" href="javascript:;" _href="<?php $str = $Think.ADMIN_PATH_NAME.$actions['PATIENTDELETE']['url'];echo U($str,array('key'=>$actions['PATIENTDELETE']['key'],'id'=>$vo['id']))?>">删除</a><?php endif; ?>
                           </td>
                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                    <?php else: ?>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容!</td><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        <?php echo ($_page); ?>
    </div>

</div>
<!--引入js,css-->
<link type="text/css" href="/Public/static/uploadify/uploadify.css" rel="stylesheet"/>
<script type="text/javascript" src="/Public/static/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="/Public/static/common/js/func.js"></script>
<script type="text/javascript" src="/Public/static/common/js/index.js"></script>
<script type="text/javascript">
    var search_obj = {name:'name'};

    var search_url = "<?php echo U('',array('key'=>'PATIENTLIST'));?>";

    //家庭档案查询
    $("#family").click(function(){
        var family= $(this).find("input[type='hidden']");

        search_obj={family_id:family};
        var url = "<?php echo U('',array('key'=>'PATIENTLIST'));?>";
        //提交请求
        location.href = handleSearch(search_obj,search_url);
    });
    $(function () {
        //上传excel
        var config = {
            text:'excel导入',
            multi:false,
            size:'<?php echo ($upload_conf["maxSize"]); ?>B',
            ext:'<?php echo ($upload_conf["u_exts"]); ?>',
            handle:"<?php echo U('/Admin/Common/Upload/excel');?>",
            formData:{handle1:'Patient',handle2:'Patient',method:'excel'}
        };
        handleUpload('excel_uploader',config,success_func,error_func);
    });

    //上传成功处理函数
    function success_func(data) {
        layer_success('添加成功',1500,location.reload());
    }
    //上传失败处理函数
    function error_func(data){
        if(data.code==3){
            var html = '<div style="padding: 20px;"><span>失败数: '+data.count+'</span><br><span>下载失败文档: <a target="_blank" href="/'+data.path+'" style="color:red" onclick="layer.closeAll()">点我下载</a></span></div>';
            layer.open({
                type: 1,
                area: ['300px', '200px'],
                skin: 'layui-layer-demo',
                shift: 2,
                title: '上传失败说明',
                shadeClose: true,
                content: html
            });
        }else{
            layer.alert(data.msg);
        }
    }
    /*管理员-编辑*/
    function admin_edit(title, url, id, w, h) {
        layer_show(title, url, w, h);
    }
</script>